﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public class AngleDisPointsGet : AuxiliaryPointsGet
	{
		public AngleDisPointsGet(XYZ minArgu, XYZ maxArgu, XYZ anglePtArgu, double xDisArgu, double yDisArgu, ref Dictionary<XYZ, XYZ> dicxArgu, ref Dictionary<XYZ, XYZ> dicYArgu) : base(ref dicxArgu, ref dicYArgu)
		{
			this.min = minArgu;
			this.max = maxArgu;
			this.anglePt = anglePtArgu;
			this.xDis = xDisArgu;
			this.yDis = yDisArgu;
		}

		public override bool GetPoints()
		{
			double num = this.min.DistanceTo(this.max);
			double num2 = this.anglePt.DistanceTo(this.max);
			XYZ xyz = (this.max - this.min).Normalize();
			XYZ xyz2 = (this.anglePt - this.max).Normalize();
			XYZ key = new XYZ(0.0, 0.0, 0.0);
			XYZ value = new XYZ(0.0, 0.0, 0.0);
			double num3 = 0.0;
			double num4 = 0.0;
			if (this.yDis > 0.0)
			{
				do
				{
					key = this.min + num3 * xyz;
					value = this.min + num3 * xyz + num2 * xyz2;
					this.dicY.Add(key, value);
					num3 += this.yDis;
				}
				while (num3 < num);
			}
			if (this.xDis > 0.0)
			{
				do
				{
					key = this.min + num4 * xyz2;
					value = this.max + num4 * xyz2;
					this.dicX.Add(key, value);
					num4 += this.xDis;
				}
				while (num4 < num2);
			}
			return true;
		}

		protected XYZ min;

		protected XYZ max;

		protected XYZ anglePt;

		protected double xDis;

		protected double yDis;
	}
}
